// 页面加载完成后检查认证状态
document.addEventListener('DOMContentLoaded', async () => {
    const isAuthenticated = await checkAuth();
    
    // 根据认证状态更新按钮显示
    const heroButtons = document.querySelector('.hero-buttons');
    if (heroButtons) {
        if (isAuthenticated) {
            heroButtons.innerHTML = `
                <a href="/products.html" class="hero-button">浏览商品</a>
                <a href="/profile.html" class="hero-button">个人中心</a>
            `;
        } else {
            heroButtons.innerHTML = `
                <a href="/login.html" class="hero-button">登录</a>
                <a href="/login.html" class="hero-button">注册</a>
            `;
        }
    }
}); 